package com.zty.BO;

import lombok.Data;

import java.util.Objects;

/**
 * @Author ZTY
 * @Description 要注册到Meta中的一个服务器信息
 * @Date 10:54 2023-12-23
 **/

@Data
public class ServerInfo {
    private String serviceId;
    private String host;
    private Integer port;

    //  判断服务器是否存活（通过preTimestamp和当前时间作比较进行判断）
    private Long preTimestamp;
    private boolean aliveStatus;
    private String schema;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServerInfo that = (ServerInfo) o;
        return Objects.equals(serviceId, that.serviceId) && Objects.equals(host, that.host) && Objects.equals(port, that.port) && Objects.equals(schema, that.schema);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serviceId, host, port, schema);
    }
}
